package ${package.Controller};


import org.springframework.web.bind.annotation.RequestMapping;
import ${cfg.appService}.${cfg.appServiceName};
import com.alibaba.dubbo.config.annotation.Reference;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import com.ylink.ecs.model.ResponseCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>
import ${package.Entity}.${entity};
/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Api(tags = {"${table.comment!}"})
@Slf4j
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>

    @Reference
    private ${cfg.appServiceName} ${cfg.appServiceName?uncap_first} ;

    /**
     * 根据id查询
     *
     * @param id
     * @return
     */

    @ApiOperation(value = "根据id获取数据",notes = "根据id获取数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "数据id", required = true),
    })
    @GetMapping("/v1/findById/{id}")
    public ResponseCode<${entity}> findById(@PathVariable("id") String id) {
        return ResponseCode.buildSuccess(true, ${cfg.appServiceName?uncap_first}.findById(id));
    }

}
</#if>
